package net.peelmeagrape.hibernate;

import net.peelmeagrape.hibernate.xmlgen.XmlAttribute;
import net.peelmeagrape.hibernate.xmlgen.XmlElement;
import net.peelmeagrape.hibernate.xmlgen.AddPropertyNameAsAttribute;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;

/**
 * A mapped query-list allows a named query to be attached to a property of the
 * domain model
 */
@Target({METHOD,FIELD}) @Retention(RUNTIME)
@XmlElement(name="query-list")
@AddPropertyNameAsAttribute(name="name")
public @interface QueryList
{
    /**
     * Should match {@link net.peelmeagrape.hibernate.Query#name()} for some
     * {@link Query}.
     */
    @XmlAttribute("query-ref") String value() default "";
}
